//
//  TCLYIntegralCollectionViewCell.m
//  YuErmuYing
//
//  Created by LYang on 16/9/2.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "TCLYIntegralCollectionViewCell.h"
#import "Macros.h"
#import "Masonry.h"

@implementation TCLYIntegralCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.brandLabel = [[UILabel alloc] init];
        self.brandLabel.numberOfLines = 1;
        self.brandLabel.textColor = blackFont;
        self.brandLabel.textAlignment = NSTextAlignmentLeft;
        self.brandLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:self.brandLabel];
        [self.brandLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(10/667.0*screenHeight);
            make.left.mas_equalTo(6/375.0*screenWidth);
            make.width.mas_equalTo((screenWidth-48)/5);
            make.height.mas_equalTo(30/667.0*screenHeight);
        }];
        
        self.nameLabel = [[UILabel alloc] init];
        self.nameLabel.numberOfLines = 0;
        self.nameLabel.textColor = blackFont;
        self.nameLabel.textAlignment = NSTextAlignmentLeft;
        self.nameLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:self.nameLabel];
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.brandLabel.mas_bottom).offset(6/667.0*screenHeight);
            make.left.mas_equalTo(6/375.0*screenWidth);
            make.width.mas_equalTo((screenWidth-48)/5);
            make.height.mas_equalTo(30/667.0*screenHeight);
        }];
        
        self.goodsImageView = [[UIImageView alloc] init];
        [self addSubview:self.goodsImageView];
        [self.goodsImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.brandLabel);
            make.left.mas_equalTo(self.nameLabel.mas_right).offset(0);
            make.right.mas_equalTo(self.mas_right).offset(-6/375.0*screenWidth);
            make.bottom.mas_equalTo(-10/667.0*screenHeight);
        }];
        
        self.introduceLabel = [[UILabel alloc] init];
        self.introduceLabel.textColor = grayFont;
        self.introduceLabel.textAlignment = NSTextAlignmentLeft;
        self.introduceLabel.numberOfLines = 0;
        self.introduceLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:self.introduceLabel];
        [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.nameLabel.mas_bottom);
            make.left.mas_equalTo(self.nameLabel);
            make.right.mas_equalTo(self.nameLabel);
            make.height.mas_equalTo(50/667.0*screenHeight);
        }];
    }
    return self;
}
@end
